<template>
	<view class="c-wrap">
		<u-swiper :list="sr.csmwjbanner" imgMode="aspectFill" keyName="image"
			v-if="sr.csmwjbanner!=null && sr.csmwjbanner!=''">
		</u-swiper>

		<view class="c-block">
			<view class="c-title">问卷列表</view>
		</view>
		<view class="c-block-full">
			<u-cell-group>
				<view v-for="(item, index) in sr.list" :key="index" @click="click" :data-id="item.id"
					:data-locales="item.locales">
					<u-cell :title="item.name" :isLink="true" arrow-direction="right"></u-cell>
				</view>
			</u-cell-group>
			<view style="text-align: center;" v-if="sr.list==null||sr.list.length==0">没有数据 No Data</view>
		</view>
	</view>
</template>

<script>
	/*
		<datebarcomponent :id="sp.id" v-on:change="changeDatebar"></datebarcomponent>
		import datebarcomponent from '@/pages/csm/components/datebarcomponent.vue'
		components: {
			datebarcomponent
		},
	*/
	export default {
		props: {
			id: {
				type: String
			},
		},
		data() {
			return {
				sp: {},
				param: {},
				sr: {
					csmwjbanner: null,
					list: {}
				},
			}
		},
		created() {
			let that = this;
			that._initPage();
			uni.$on('onComponentShow', (data) => {
				that._initPage();
			})
		},
		methods: {
			_initPage(isForceDisplay) {
				let that = this;
				uni.setNavigationBarTitle({
					title: that.$t('csmwj.page_title.home')
				});
				console.log('ready to load paper list');
				that.$u.c.ajaxget('csmwj/csmwj/pagemain', {}, function(res) {
					that.sr.list = res.list;
					console.log(that.sr.csmwjbanner);
					that.sr.csmwjbanner = that.$u.c.uswiperAdjustImages(res.csmwjbanner);
					console.log(that.sr.csmwjbanner);
				});
			},
			click: function(e) {
				let that = this;
				console.log('click cell', e);
				that.$u.route({
					url: 'pages/csmwj/paper/paper',
					params: {
						id: e.currentTarget.dataset.id,
						locales: e.currentTarget.dataset.locales,
					}
				});
			},
		}
	}
</script>

<style lang="scss">

</style>
